<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<s:form method="post" action="submitAdminRights" id="form"
	namespace="/admin" theme="simple">
	<table class="verdana12blacknormal" width="100%">
		<tbody>
			<tr>
				<td height="40" class="sectionheading bottom-border">
					Admin Rights
				</td>
				<td height="40" class="sectionheading bottom-border">
					<a href="adminRights.htm" class="navi-link">Add new Admin User</a>
				</td>
				</tr>
				<tr>
				<td height="40" class="sectionheading bottom-border">
					<s:actionerror />
					<s:actionmessage />
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%">
						<tr align="left">
							<td class="verdana12blacknormal">
								Admin User Id:
							</td>
							<td>
								<s:hidden name="admin.id" theme="simple" />
								<s:textfield name="admin.username" theme="simple" />
							</td>
						</tr>
						<tr align="left">
							<td class="verdana12blacknormal">
								Admin Password:
							</td>
							<td>
								<s:password name="admin.password" theme="simple" showPassword="true" value="%{admin.password}" />
							</td>
						</tr>
						<tr align="left">
							<td class="verdana12blacknormal">
								Allowed Modules
							</td>
							<td>
								<s:select list="adminModules" name="allowedModules" theme="simple"  
									listKey="id" listValue="description" multiple="true" size="6" />
							</td>
						</tr>
						<tr align="left">
							<td>
								&nbsp;
							</td>
							<td>
								<s:submit  type="image" 
									src="../Admin-Images/submit-btn.gif" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</tbody>
	</table>
	<display:table name="admins" id="parent" class="right-border verdana12blacknormal">
		<display:column property="username" title="Username" class="navi-link" headerClass="Table-Head" />
		<display:column title="Allowed Modules" headerClass="Table-Head">
			<s:set name="module" value="%{#attr.parent.adminModuleses}" scope="request" />
			<display:table name="module" id="row" class="right-border verdana12blacknormal"  defaultsort="1">
					<display:column property="module.description" title="Module"  headerClass="Table-Head"  />
			</display:table>
		</display:column>
		<display:column title="Edit"  headerClass="Table-Head" style="text-align: center;" >
			<s:url id="edit" action="adminRights">
				<s:param name="admin.username" value="%{#attr.parent.username}"></s:param>
			</s:url>
			<s:a href="%{edit}">
				<img src="../Admin-Images/edit-icon.gif" style="border: 0" alt="Edit">
			</s:a>
			</display:column>
			<display:column title="Delete"  headerClass="Table-Head" style="text-align: center;">
			<s:url id="delete" action="deleteAdmin">
				<s:param name="admin.id" value="%{#attr.parent.id}"></s:param>
			</s:url>
			<s:a href="%{delete}">
				<img src="../Admin-Images/delete-icon.gif"
							style="border: 0" alt="Delete">
			</s:a>
		</display:column>		
	</display:table>
</s:form>